package dk.pun.aot.client.dice;

public class DiceRoll {

	private String title;
	private DicePoolType dicePoolType;
	private int modifier;
	private String rolls;
	private int result;
	private DiceRollStandardDifficultyType difficultyType;

	public DiceRoll(String title, DicePoolType dicePoolType, int modifier, String rolls, int result, DiceRollType type) {
		this.title = title;
		this.dicePoolType = dicePoolType;
		this.modifier = modifier;
		this.rolls = rolls;
		this.result = result;
		
		for (DiceRollStandardDifficultyType difficultyType : DiceRollStandardDifficultyType.values()) {
			if (type == DiceRollType.SKILL) {
				if (result >= difficultyType.getSkillCheckDR()) {
					this.difficultyType = difficultyType;
				}
			}
			if (type == DiceRollType.QUALITY || type == DiceRollType.RESIST) {
				if (result >= difficultyType.getQualityCheckDR()) {
					this.difficultyType = difficultyType;
				}
			}
		}
	}

	public String getTitle() {
		return this.title;
	}
	
	public DicePoolType getDicePoolType() {
		return this.dicePoolType;
	}

	public int getModifier() {
		return this.modifier;
	}
	
	public String getRolls() {
		return this.rolls;
	}

	public int getResult() {
		return this.result;
	}

	public DiceRollStandardDifficultyType getDifficultyType() {
		return this.difficultyType;
	}
	
	public String toString() {
		return "" + this.result + " (" + this.rolls + ")";
	}
	
}
